

#include "slepbase.h"

void experiment_submatmult2(){
	slep_matrix *A,*X;
	slep_vector *Ax;
	int i;
	int ind[] = {0,4,5,7};
	int k=3;

	X = slepAllocDenseMatrix(9,3);
	A = slepAllocDenseMatrix(7,9);
	Ax = slepAllocDenseVector(7);

	DMEMSET(X->data.mtrx,3.0,9*3,i);
	DMEMSET(X->data.mtrx,2.0,9*2,i);
	DMEMSET(X->data.mtrx,1.0,9*1,i);

	DMEMSET(A->data.mtrx,1.0,7*9,i);

//	slep_randn(y->data.vctr,7,0.0,1.0);
//	slep_randn(A->data.mtrx,7*9,0.0,1.0);

	DMEMSET(Ax->data.vctr,0.0,7,i);
	slepVerbConsoleWrDMat(A);
	slepVerbConsoleWrDMat(X);
	slepVerbConsoleWrDVec(Ax);	
	{
		slep_matrix A_i = *A;
		slep_vector Ax_i= *Ax, x_i;
		x_i.dim = X->m;
		x_i.inc = 1;
		x_i.sparsity = SlepDense;
		for(i=0; i < k ; i++){
			A_i.m = ind[i+1] - ind[i];
			Ax_i.dim = ind[i+1] - ind[i];
			A_i.data.mtrx = &(A->data.mtrx[ind[i]]);
			Ax_i.data.vctr = &(Ax->data.vctr[ind[i]]);
			x_i.data.vctr = &(X->data.mtrx[i*(X->ld)]);
			slep_daAxpby(SlepNoTranspose,1.0, &A_i, &x_i, 0.0, &Ax_i);
		}
	}

	slepVerbConsoleWrDVec(Ax);

}